\chapter{Conclusions} \label{chap:conclusions}
\lettrine[lines=3]{S}{ynthesis}
\cbstart
and control-quality optimization can be performed
efficiently for embedded control systems with
multiple operation modes, computation components with
susceptibility to permanent faults, and multiple control applications
with state-triggered execution in resource-constrained environments.
\cbend
The complex temporal properties of the execution and communication in
modern embedded control systems are acknowledged as major factors to
consider during control synthesis, computer-systems design, and
control-quality optimization in an integrated manner.  In
Chapter~\ref{chap:distributed}, we presented such a synthesis and
optimization framework for multiple control applications on
distributed embedded platforms. The framework supports several
scheduling policies (static cyclic scheduling and priority-based scheduling) and
communication protocols (TTP, CAN, and FlexRay) of the underlying
execution platform.  

Embedded control systems must be able to
react and adapt to various changes in the operational environment at
runtime. Such requirements lead to scaling problems because of the
very large number of situations that may occur at runtime.  In
Chapters~\ref{chap:multimode}--\ref{chap:selftriggered}, we have
approached the synthesis problem for adaptive embedded systems by
optimizations and approximations to be performed at design time, as
well as efficient solutions for decisions to be taken at runtime as a
response to several sources of runtime variability.  We have taken
several approaches to the design of adaptive embedded systems for
control applications, motivated by the presence of multiple operation
modes, probabilities of component failures, and varying requirements
on the level of resource usage at runtime.

Chapter~\ref{chap:multimode} presents a problem formulation and
solution for the synthesis of embedded control systems with multiple
operation modes. The main design and optimization difficulty is raised
by the very large number of modes that the system may switch to at
runtime.  We have developed heuristics for 
trade-offs between several competing objectives:
control quality, optimization time, and the platform memory needed to
store design solutions for multiple operation modes.
In Chapter~\ref{chap:faulttolerance}, we considered a similar problem as
in Chapter~\ref{chap:multimode} for systems in which computation nodes
may fail at runtime.  A similar design difficulty, although one that
must be approached differently than in Chapter~\ref{chap:multimode},
is due to the large number of combinations of
operational computation components at runtime. The main objective
is to find optimized solutions for fault-tolerant execution of the control applications
for a set of fault scenarios.
The approach taken in
Chapter~\ref{chap:faulttolerance} is based on synthesis of solutions
for a limited number of situations that may occur at runtime due to
permanent faults, as well as trade-offs between task migration and
memory space. 

Periodic control is the underlying execution model of control
applications considered in
Chapters~\ref{chap:distributed}--\ref{chap:faulttolerance}.  In
Chapter~\ref{chap:selftriggered}, we considered self-triggered control
as an alternative execution model. The main advantage of
self-triggered control is its ability to reduce the number of
controller executions compared to periodic implementations.  This is
motivated in any environment in which tight constraints are imposed on
the amount of sensor measurements, actuations, and resource usage
related to computation and communication.
For example, this is the case in systems where control
applications coexist with other application tasks with varying
resource demand, or when the requirements on energy consumption are
changing at runtime.  We proposed a scheduling component for
runtime-management of computation resources shared by multiple
self-triggered control applications. The solution is based on
design-time approximations and a runtime-scheduling heuristic.

In the remainder of this chapter, we shall summarize the research
contributions and conclusions separately for the problems and
solutions presented in this thesis.  The chapter organization follows
the order in which the contributions are presented throughout the
thesis.



\section{Integrated Control and Scheduling}
In Chapter~\ref{chap:distributed}, we proposed a system-level design
approach for integrated period assignment, controller synthesis, and
scheduling of tasks and messages on distributed embedded systems. The
construction of design solutions is an optimization process that is driven by
control quality. We considered several decision variables that affect
the performance of the multiple control loops in the system. These variables 
are the execution period of each application and its control law. Further, the
periods and the scheduling of tasks and messages on the individual
computation and communication components in the system influence the
control quality through the delay characteristics. This is the key issue
that has been considered in the integrated design framework. 

Our solution to the problem of integrated control and scheduling for distributed
embedded systems is based on the integration of several optimization
methods.  We used genetic algorithms for period and priority
assignment to the tasks and messages constituting the control
applications. For the case of static cyclic scheduling of tasks and
messages, we used a framework for constraint logic programming and a
cost function that combines average sensor--actuator delays and their
variance. Controller synthesis with delay compensation is integrated
with the solutions for period assignment and scheduling. Experimental
results have demonstrated significant quality improvements when using
the synthesis framework in Chapter~\ref{chap:distributed}, instead of
a traditional approach for which control design and computer-systems
optimization are separated.




\section{Multi-Mode Control Systems}
Multiple operation modes of distributed embedded control systems is
the topic of Chapter~\ref{chap:multimode}. We considered that the set
of controlled plants may change during operation. To achieve optimal
usage of the computation and communication resources of the underlying
execution platform, customized solutions (schedules and controllers)
must be synthesized for each possible operation mode at design time.
The large and complex design space, which is an inherent property for
design problems of adaptive embedded systems, leads to long
design times and requirements on large amount of platform memory,
if optimal solutions are required to be implemented.

We proposed techniques to find appropriate trade-offs
among several competing parameters:
control quality, design time, and the amount of memory
required to store the design solutions generated by our framework.
The techniques are based on the synthesis of a set of mandatory
solutions for a proper operation of the system in all possible
functional modes, as well as an optimization process that produces additional,
incremental improvements of the overall control quality of the system.
As a last step of the optimization process, for the case of limited
memory space of the execution platform, we formulated an integer
linear program to be solved at design time. 
Experimental results have
validated that high-quality solutions for multi-mode control systems
can be synthesized efficiently. If the synthesis problem for
multi-mode systems has very tight memory constraints, we have
demonstrated that virtual modes, which do not occur at runtime, can be
considered during synthesis to generate design solutions that 
cover several functional modes in a
memory-efficient manner.




\section{System Synthesis and Permanent Faults}
The work in Chapter~\ref{chap:faulttolerance} is motivated by the need
to tolerate and adapt to component faults at runtime. We considered
situations that occur at runtime as a consequence of failed
computation nodes in the underlying distributed execution platform.
The design space is
complex because of the many different sets of failed components at
runtime. To give guarantees on fault tolerance, we considered the
mandatory synthesis of a set of minimal configurations of the system. By
supporting execution in such configurations, the system is able to
operate in a large set of additional configurations that arise
when computation nodes fail.
\cbstart
Solutions for minimal configurations
enable the system to 
be resilient to many scenarios with
failed computation nodes by operating with a minimum
level of control quality.
\cbend

To improve control quality relative to the minimum level of quality given by the
solutions for minimal configurations, we proposed an optimization approach that considers
additional configurations in an incremental manner. The search order
is based on probabilities that are associated to each configuration. We have
also elaborated on the trade-off between migration time and memory
usage for the implementation of design solutions on the execution
platform. This trade-off between task migration and task replication
is formulated as an integer linear program and is solved efficiently with 
negligible time overhead. Supported by the
presented experimental results, we conclude that we can construct
design solutions efficiently to guarantee fault-tolerant operation at
runtime. We have also demonstrated that significant quality
improvements can be achieved with relatively little additional design
time. In addition to this design time, a limiting factor for quality
improvement is the memory space that is available for task replication
and storage of design solutions.




\section{Self-Triggered Control Applications}
Self-triggered control is an execution paradigm that has been developed with 
the main motivation to decrease the number of controller executions compared 
to traditional periodic control. 
Nevertheless, there has been little work on the deployment of multiple such control applications
on a shared computation platform. In Chapter~\ref{chap:selftriggered},
we discussed scheduling of the execution of multiple self-triggered control tasks on 
a uniprocessor platform.
Self-triggered control tasks compute deadlines for their future executions
based on the sampled plant states. Therefore, 
scheduling decisions for task execution need to be done at runtime.
Further, the need for optimization and trade-off between control quality and CPU usage
raises additional difficulties when developing efficient scheduling policies.

The scheduling approach presented in Chapter~\ref{chap:selftriggered} is based on
design-time approximations to avoid time-consuming computations at runtime.
At runtime, the scheduling policy is based on a fast search procedure and a
heuristic to solve conflicts in task executions. The scheduling decisions are
guided by control quality and CPU usage. We have also discussed a complementary
scheduling policy to guarantee that stability and a minimum level of control performance 
is maintained during system operation. 
Experimental results have demonstrated that control quality and resource usage
can be optimized for multiple self-triggered control applications with low time overhead.







